﻿@using ZhouYu.DreamTour.Web.Models;
@{
    var UserInfo = UserInfoContext.userInfoContext.UserInfo;
}
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>中国梦想游-会员登录页</title>
    <link href="~/css/style.css" rel="stylesheet" type="text/css" />
    <link href="~/css/common.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="~/layui-v2.5.4/layui/css/layui.css" />
    <link href="~/css/common.css" rel="stylesheet" type="text/css" />
    <script src="~/js/jquery-3.3.1.min.js"></script>
    <script src="~/layui-v2.5.4/layui/layui.js"></script>
    <script src="~/js/modth.js"></script>
    <script src="~/js/city.js"></script>
</head>
<style>
    * {
        font-size: 12px;
    }

    #addr-show {
        display: none;
    }

    #Address {
        width: 300px;
        height: 52px;
    }

    #button-show {
        display: none;
    }

    #UserId {
        display: none;
    }

    #FAdress {
        display: none;
    }

    #BsAdress {
        display: none;
    }

    #CsAdress {
        display: none;
    }
    #FAdress{
        display:none
    }
    #Delivery_Id{
        display:none
    }
</style>
<body>
    <div class="top_hw clearfix">
        <div class="top_h clearfix">
            <div class="top_hl"><span>欢迎来到中国梦想游，让你的梦想全程免费自由行！</span> 预定热线：<b>0571-63322269</b></div>
            <div class="top_hr">
                @if (UserInfo == null)
                {
                    <a href="/Home/User_Register">会员注册</a>
                    <span>|</span> <a href="/Home/User_Login">登录</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a>
                    @*<a>
                欢迎你，来到新世界旅行网！
            </a>*@
                }
                else
                {
                    <a href="/Home/User_Center">会员中心</a>
                    <span>|</span> <a href="#">梦想收藏</a> <span>|</span> <a href="#">设为首页</a> <span>|</span> <a href="/Login/LoginOut">退出</a> <span>|</span>
                    <a>
                        欢迎你，<span>@UserInfo.User_Name</span>来到新世界旅行网！
                    </a>
                }
            </div>
        </div>
    </div>

    <div class="head_w">
        <div class="head_t clearfix">
            <div class="logo"><img src="~/images/logo.jpg"></div>
            <div class="rx_line"><img src="~/images/rx.jpg"></div>
        </div>
    </div>

    <div class="fmright" id="FAdress">
        <div class="fmr1">
            <div class="fmr1_top">配送地址</div>

            <div class="fmr1_m">
                <table border="0" cellpadding="0" cellspacing="0" width="638">
                    <tr>
                        <td width="60" align="left" height="30">收件人：</td>
                        <td width="578" align="left" height="30">
                            @if (UserInfo != null)
                            {
                                <input type="text" id="UserId" value="@UserInfo.User_Id">
                            }

                            <input type="text"  id="Delivery_Id">
                            <input id="Name" type="text" class="finput3" onblur="JudgeName()" style="color:#000000"> &nbsp;<span class="fspan9" id="num1"></span>
                        </td>
                    </tr>
                    <tr id="EsAdress">
                        <td width="100" align="left" height="30">配送地址：</td>
                        <td width="578" align="left" height="30">
                            <input id="LAdress" type="text" onclick="TF()" class="finput3" style="color:#000000"> &nbsp;<span class="fspan9" id="num1"></span>
                        </td>
                        </tr>

                    <tr id="BsAdress">
                        <td width="100" align="left" height="30">配送地址：</td>
                        <td width="578" align="left" height="30">
                            <div>
                                <fieldset>
                                    <form action="#">
                                        <label for="addr-show">
                                            <input type="text" value="" id="addr-show">
                                        </label>
                                        <!--省份选择-->
                                        <select id="prov" onchange="showCity(this)">
                                            <option>请选择省份</option>

                                        </select>

                                        <!--城市选择-->
                                        <select id="city" onchange="showCountry(this)">
                                            <option>请选择城市</option>
                                        </select>

                                        <!--县区选择-->
                                        <select id="country" onchange="selecCountry(this)">
                                            <option>请选择县区</option>
                                        </select>
                                        <button type="button" class="btn met1"  id="button-show">确定</button>
                                    </form>
                                </fieldset>
                            </div>
                        </td>
                    </tr>
                    <tr id="CsAdress">
                        <td width="60" align="left" height="30" id="">详细地址:</td>
                        <td width="578" align="left" height="30">

                            <textarea class="cndzk-entrance-associate-area-textarea" onblur="JudgeAddress()" id="Address" rows="2" cols="20" placeholder="请输入详细地址信息，如道路、门牌号、小区、楼栋号、单元等信息" style="color:#000000"></textarea>
                            &nbsp;<span class="fspan9" id="num2"></span>
                        </td>
                    </tr>
                    <tr>
                        <td width="100" align="left" height="30">邮编：</td>
                        <td width="578" align="left" height="30">

                            <input type="text" id="Zipcode" class="finput4"  onblur="JudgeZipcode()"  style="color:#000000">

                            &nbsp;<span class="fspan9" id="num3"></span>
                        </td>
                    </tr>
                    <tr>
                        <td width="100" align="left" height="30">手机：</td>
                        <td width="578" align="left" height="30">


                            <input type="text" id="Phone" class="finput3" onblur="Judgephone()" style="color:#000000">

                            &nbsp;<span class="fspan9" id="num4"></span>
                        </td>
                    </tr>

                    <tr>
                        <td colspan="2" height="40">

                            <input type="image" onclick="modifyAdress()" id="btqn" src="~/images/fbtn4.png">
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>


    <div class="mainNav clearfix">
        <ul class="Nav_ul">
            <li><a href="/Home/Index">首页</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Route">旅游路线</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Scenic">旅游景点</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/CateringAccommodation">餐饮住宿</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Traffic_DatailsOne">交通线路</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Group">旅游团购</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Specialty">地方特产</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/AutoGenerationIntro">自动生成简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Team_Join">团队简介</a><img src="~/images/nav_line.jpg"></li>
            <li><a href="/Home/Itinerary_Details">行程导航</a></li>
        </ul>
    </div>
    <div class="b_wrap">
        <div class="current"><span>当前所在地：</span><a href="/Home/Index">首页</a> >> <a href="/Home/User_Center">会员中心</a></div>
        <div class="fmember">
            <div class="fmleft">
                <div class="fmleft_top"><img src="~/images/fmbt1.png" border="0"></div>
                <div class="fmlist">
                    <ul>
                        <li class="f1">订单中心</li>
                        <li> >><a href="/Home/User_Order">我的订单</a> </li>
                        <li> >><a href="/Home/User_Colleague">发布结伴同行</a> </li>
                        <li> >><a href="/Home/User_Apply">我申请的结伴同行</a> </li>
                        <li> >><a href="/Home/User_Comment">我的点评</a> </li>
                        <li class="f2"> >><a href="/Home/User_Questions">我的提问</a> </li>
                    </ul>
                    <ul>
                        <li class="f1">我的优惠卡券</li>
                        <li> >><a href="/Home/User_CashAccount">现金账号</a> </li>
                        <li> >><a href="/Home/User_AllowanceVol">抵用券</a> </li>
                        <li class="f2"> >><a href="/Home/User_TouristVol">旅游券</a> </li>
                    </ul>
                    <ul>
                        <li class="f1">账户信息</li>
                        <li> >><a href="/Home/User_Data">个人资料</a> </li>
                        <li> >><a href="/Home/User_AccountSecurity">账户安全</a> </li>
                        <li>
                            >>
                            <a href="/Home/User_Bank">我的银行卡</a>
                        </li>
                        <li> >><a href="/Home/User_Integral">我的积分</a> </li>
                        <li> >><a href="/Home/User_UpdatePwd">修改密码</a> </li>
                        <li class="f2"> >><a href="/Home/User_Address">配送地址</a> </li>
                    </ul>
                </div>
            </div>
            <div class="fmright">
                <div class="fmr1">
                    <div class="fmr1_top">配送地址</div>
                    <div class="fmr1_m">


                        <a href="/Home/User_AddressTwo"><input type="image" src="/images/fbtn3.png"></a>

                        <table class="layui-hide" id="test" lay-filter="test">
                        </table>

                        <script type="text/html" id="barDemo">
                            <a href="#" lay-event="edit">编辑</a> |
                            <a href="#" lay-event="del">删除</a> |
                            <a href="#" lay-event="default">默认</a>
                        </script>
                    </div>
                </div>
            </div>
        </div>
    </div>






    <script src="~/js/jquery-3.3.1.min.js"></script>
    <script src="~/js/city.js"></script>
    <script src="~/js/modth.js"></script>
    <script>
        //表格数据加载
        layui.use('table', function () {
            var table = layui.table;
            table.render({
                elem: '#test'
                , url: '/User/AddressesList?UserId=' +@UserInfo.User_Id
                    , cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                , cols: [[
                    { field: 'Delivery_Name', title: '收件人', align: 'center' }
                    , { field: 'Delivery_Adress', title: '配送地址', align: 'center' }
                    , { field: 'Delivery_Zipcode', title: '邮编', align: 'center' }
                    , { field: 'Delivery_TelPhone', title: '手机', align: 'center' }
                    , { field: 'right', width: 165, title: '操作', toolbar: '#barDemo', align: 'center' }
                ]]
            });
            table.on('tool(test)', function (obj) {
                var data = obj.data;
                if (obj.event === 'detail') {
                    layer.msg('ID：' + data.id + ' 的查看操作');
                } else if (obj.event === 'del') {
                    layer.confirm('真的删除行么', function (index) {
                        $.ajax({
                            url: "/User/DeleteAddress?Id=" + data.Delivery_Id,//根据Id实现删除
                            type: "Post",
                            success: function (data) {
                                if (data.Success) {
                                    layer.msg('删除成功！', {
                                        title: '提示框',
                                        icon: 1,
                                        time: 2000
                                    }, function () {
                                        TableReload();
                                        layer.close(index);
                                    });
                                    window.location.reload();//刷新页面
                                }
                                else {
                                    layer.msg('删除失败！', {
                                        title: '提示框',
                                        icon: 1,
                                        time: 2000
                                    });
                                }
                            }
                        });
                    });
                } else if (obj.event == 'default') {
                    if (data.Delivery_state == 1) {
                        layer.msg('已选为默认地址');
                    } else {
                           $.ajax({
                                    url: "/User/UpdateAlladdressStates?UserId="+@UserInfo.User_Id,
                                    type: "post",
                                    success: function (result) {
                                    if (result.Success) {
                           $.ajax({
                                   url: "/User/Modifyaddressstatus?Id=" + data.Delivery_Id,
                                    type: "post",
                                    success: function (result) {
                                        if (result.Success) {
                                              layer.msg('已选为默认地址');

                                        }
                                    }
                                })
                                        }
                                    }
                                })
                    }
                }
                else if (obj.event === 'edit') {
                    $("#Name").val(data.Delivery_Name);//收件人
                    $("#LAdress").val(data.Delivery_Adress);//详细地址
                    $("#Zipcode").val(data.Delivery_Zipcode);//邮编
                    $("#Phone").val(data.Delivery_TelPhone)//手机号码
                    $("#Delivery_Id").val(data.Delivery_Id);//ID
                   //修改div弹窗
                   layer.open({
                   type: 1,
                   title: "修改",
                   area: ['710px', ''],
                   shadeClose: false,
                   content: $("#FAdress"),
                   });
                    


                }
            });
        });
        function TF() {
            $("#BsAdress").show();
            $("#CsAdress").show();
            $("#LAdress").val(null);
            $("#EsAdress").hide();
        }
    </script>

</body>
</html>